<template>
  <div class="userInfo">
    <el-avatar
      src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
    ></el-avatar>
    <el-dropdown style="padding-left: 10px">
      <span class="el-dropdown-link">
        Dropdown List
        <el-icon class="el-icon--right">
          <arrow-down />
        </el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>个人信息</el-dropdown-item>
          <el-dropdown-item>系统管理</el-dropdown-item>
          <el-dropdown-item @click="handleLoginOut">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts" setup>
// import { ref } from 'vue';
import { ArrowDown } from '@element-plus/icons-vue';

import localCache from '@/utils/cache';
import { useRouter } from 'vue-router';

const router = useRouter();

const handleLoginOut = () => {
  localCache.removeCache('token');
  router.push('/main');
};
</script>

<style lang="less" scoped>
.userInfo {
  display: flex;
  align-items: center;
}
</style>
